package cn.tedu.controller;

import cn.tedu.pojo.User;
import cn.tedu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
public class UserController {
    @Autowired
    private UserService userService;
    @GetMapping("in")
    public String userInsert(User user){
        userService.userInsert(user);
        return "操作成功！";
    }
    @GetMapping("id")
    public User ourSelectById(Integer id){
        return userService.ourSelectById(id);
    }
    @GetMapping("del")
    public String ourDeleteByName(String name){
        userService.ourDeleteByName(name);
        return "删除成功！";
    }
    @GetMapping("ni")
    public List<User> selectByNI(User user){
        return userService.selectByNI(user);
    }
    @GetMapping("as")
    public List<User> selectByAS(User user){
        return userService.selectByAS(user);
    }
    @GetMapping("like")
    public List<User> selectLikeName(String s){
        return userService.selectLikeName(s);
    }
    @GetMapping("order")
    public List<User> selectOrderByAge(String sex){
        return userService.selectOrderByAge(sex);
    }
    @GetMapping("order2")
    public List<User> selectOrderByAge2(Integer age){
        return userService.selectOrderByAge2(age);
    }
    @GetMapping("some")
    public List<User> selectSomething(User user){
        return userService.selectSomething(user);
    }
    @GetMapping("selectInId")
    public List<User> selectInId(Integer[] ids){
        return userService.selectInId(ids);
    }
}
